#include<func.h>
//只读
typedef struct student
{
    int stu_num;     //学号
    const char*name; // 姓名
    int grade;       // 成绩
}Student;

// 读取结构体到文件中
int main(int argc,char*argv[])
{
    //./student file1 
    Student student[3] = {{1,"wtto",89},{2,"xixi",78},{3,"koko",91}};
    //读取到文件中
    ARGS_CHECK(argc,2);
    ERROR_CHECK(argv[1],-1,"open");
    FILE*fp =fopen(argv[1],"rb");
    

    for (int i = 0; i < 3; i++)
    {
        fwrite(&student[i],sizeof(struct student),1,fp);
    }
    fclose(fp);
    return 0;
}